package com.wujing.abstictest

object TestCylinder extends App {
  private val cylinder = new Cylinder
  cylinder.inHigh=3
  cylinder.radius=3

   val res: Double = cylinder.findVolume()
  println(res)
}

class Circle{
  var radius:Double=3d

  def setRadius(radius:Double): Unit ={
    this.radius=radius
  }

  def getRadius: Double ={
    radius
  }

  def findArea(): Double ={
    radius*radius*3.14
  }
}


class Cylinder extends Circle {

  var inHigh:Double=_
  val area: Double = findArea()
  def findVolume():Double={
    area * inHigh / 3
  }

}